package com.wz.leetcode.array;

/**
 * @Author : Wang Zhen.
 * @Date : Created in 8:49 2022/9/25
 * @Description :
 * @Modified By   :
 * @Version :
 */
public class N0070_ClimbingStairs {
    public int climbStairs(int n) {
        if (n == 1) {
            return 1;
        }
        if (n == 2) {
            return 2;
        }
        int current = 0;
        int a = 1;
        int b = 2;
        for (int i = 3; i <= n; ++i) {
            current = a + b;
            a = b;
            b = current;
        }
        return current;
    }
}
